<?php
namespace app\common\tool\profit_sharing;

class Service extends Base {
	public funciton share($order, $receivers) {
		// POST 请求要发送的数据
        $postData = [
            'sub_mchid'      => $order['sub_mch_id'],
            'transaction_id' => $order['transaction_id'],
            'out_order_no'   => $order['out_trade_no'],
            'receivers'      => $receivers,
            'pass'           => md5('xiezongxing')
        ];

        $url = 'https://xiangcunmaicai.jxoxy.com/api/recharge/xitong_profitsharing';

        $curl = loadTool('Curl');
        $response = $curl->body($url, $postData);
        $response = json_decode($response, true);
        if($response['status'] == 200) {
            $profitSharingModel->commit();
        } else {
            throw new \Exception($response['message']);
        }
        return true;
	}
}
